package com.ruoyi.web.utils.influxdb;


/**
 * @desc  和设备相关的字段
 * @author fwx
 * @date  2023/9/4 11:06
 **/
public class DeviceParamUtil {

    public static final String FIELD_DEVICE_ID  = "deviceId";

    public static final String FIELD_NUMBER_VALUE  = "numberValue";

    public static final String FIELD_VALUE  = "_value";

    public static final String DB_DEFAULT_FIELD  = "_field"; //influxDB 默认 == 字段

    public static final String DB_DEFAULT_PROPERTY  = "property"; //influxDB 默认 == 字段

    public static final String THING_TYPE_DEVICE  = "device";

    public static final String EVENT_BASE_INFO  = "baseinfor"; 
    
    public static String createEventMetric(String thingType,
                                     Long productId,
                                     String eventId) {
        return thingType + "_event_" + productId + "_" + eventId;
    }

    public static String createPropertyMetric(String thingType,
                                              Long productId) {
        return thingType + "_properties_" + productId;
    }
    
    /**
     * @desc  得到设备基础信息的 measurement 名称
     * @author fwx
     * @date  2023/9/4 11:13
     **/
    public static String createEventBaseInfoMetric(Long productId) {
        //device_47_baseinfor
        return createEventMetric(THING_TYPE_DEVICE,productId,EVENT_BASE_INFO);
    }

    public static String createPropertyMetric(Long productId) {
        //device_properties_118
        return createPropertyMetric(THING_TYPE_DEVICE,productId);
    }
    
}
